package com.tfswx.fljdmxyy.api;

import com.tfswx.fljdmxyy.dto.rzgl.*;
import com.tfswx.fljdmxyy.query.rzgl.*;
import com.tfswx.fljdmxyy.service.RzglService;
import com.tfswx.newbie.boot.starter.page.PageParam;
import com.tfswx.newbie.boot.starter.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 日志管理
 *
 * @Author 陈文佳
 * @Date 2023/03/24
 */
@Api(tags = "日志管理")
@RequestMapping("api/rzgl")
@RestController
public class RzglController {

    @Resource
    private RzglService rzglService;

    @ApiOperation("查询操作日志分类下拉数据")
    @PostMapping("/queryCzrzfl")
    public CzrzflQueryResult queryCzrzfl() {
        return rzglService.queryCzrzfl();
    }

    @ApiOperation("查询异常日志详细")
    @PostMapping("/getYcrz")
    public YcrzGetOutputDTO getYcrz(@RequestBody @Validated YcrzGetInputDTO dto) {
        return rzglService.getYcrz(dto);
    }

    @ApiOperation("查询操作日志类型下拉数据")
    @PostMapping("/queryCzrzlx")
    public CzrzlxQueryResult queryCzrzlx() {
        return rzglService.queryCzrzlx();
    }

    @ApiOperation("查询操作日志详情")
    @PostMapping("/getCzrz")
    public CzrzGetOutputDTO getCzrz(@RequestBody @Validated CzrzGetInputDTO dto) {
        return rzglService.getCzrz(dto);
    }

    @ApiOperation("保存异常日志")
    @PostMapping("/saveYcrz")
    public YcrzSaveOutputDTO saveYcrz(@RequestBody @Validated YcrzSaveInputDTO dto) {
        return rzglService.saveYcrz(dto);
    }

    @ApiOperation("查询操作日志")
    @PostMapping("/queryCzrz")
    public PageResult<CzrzQueryResult> queryCzrz(@RequestBody @Validated PageParam<CzrzQueryParam> param) {
        return rzglService.queryCzrz(param);
    }

    @ApiOperation("保存操作日志")
    @PostMapping("/saveCzrz")
    public CzrzSaveOutputDTO saveCzrz(@RequestBody @Validated CzrzSaveInputDTO dto) {
        return rzglService.saveCzrz(dto);
    }

    @ApiOperation("查询异常日志")
    @PostMapping("/queryYcrz")
    public PageResult<YcrzQueryResult> queryYcrz(@RequestBody @Validated PageParam<YcrzQueryParam> param) {
        return rzglService.queryYcrz(param);
    }
}